/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.business.router.core.repository.mapper;

import info.peigen.hotpot.business.router.core.repository.entity.RouterChannelEntity;
import info.peigen.hotpot.business.router.facade.enums.ChannelBusinessType;
import info.peigen.hotpot.business.router.facade.enums.ChannelCode;
import info.peigen.hotpot.common.core.enums.Currency;
import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

/**
 * <b>(RouterChannelMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/12
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface RouterChannelMapper extends AbstractBeetlSqlMapper<RouterChannelEntity> {
    @Sql("select * from router_channel where channel_id = ?")
    @Select
    RouterChannelEntity findByChannelId(String channelId);

    @Sql("delete from router_channel where channel_id = ?")
    @Update
    void deleteByChannelId(String channelId);

    @Sql("delete from router_channel where channel_code = ? and channel_business_type = ? and currency  = ?")
    @Update
    void deleteByCodeAndTypeAndCurrency(ChannelCode code, ChannelBusinessType channelBusinessType, Currency currency);
}